﻿using Absky.Entity.SystemManage;
using Absky.Model.Param.SystemManage;
using Absky.Service.SystemManage;
using Absky.Util;
using System.Collections.Generic;
using System.Threading.Tasks;

namespace Absky.Business.SystemManage
{
    public class LogLoginBLL
    {
        private LogLoginService logLoginService = new LogLoginService();

        #region 获取数据
        public async Task<Result<List<LogLoginEntity>>> GetList(LogLoginListParam param)
        {
            Result<List<LogLoginEntity>> obj = new Result<List<LogLoginEntity>>();
            obj.Data = await logLoginService.GetList(param);
            obj.Code = Enum.ResultCodeEnum.Success;
            return obj;
        }

        public async Task<Result<List<LogLoginEntity>>> GetPageList(LogLoginListParam param, Pagination pagination)
        {
            Result<List<LogLoginEntity>> obj = new Result<List<LogLoginEntity>>();
            obj.Data = await logLoginService.GetPageList(param, pagination);
            obj.Total = pagination.TotalCount;
            obj.Code = Enum.ResultCodeEnum.Success;
            return obj;
        }

        public async Task<Result<LogLoginEntity>> GetEntity(long id)
        {
            Result<LogLoginEntity> obj = new Result<LogLoginEntity>();
            obj.Data = await logLoginService.GetEntity(id);
            obj.Code = Enum.ResultCodeEnum.Success;
            return obj;
        }

        #endregion

        #region 提交数据
        public async Task<Result<string>> SaveForm(LogLoginEntity entity)
        {
            Result<string> obj = new Result<string>();
            await logLoginService.SaveForm(entity);
            obj.Data = entity.Id.ParseToString();
            obj.Code = Enum.ResultCodeEnum.Success;
            return obj;
        }

        public async Task<Result> DeleteForm(string ids)
        {
            Result obj = new Result();
            await logLoginService.DeleteForm(ids);
            obj.Code = Enum.ResultCodeEnum.Success;
            return obj;
        }

        public async Task<Result> RemoveAllForm()
        {
            Result obj = new Result();
            await logLoginService.RemoveAllForm();
            obj.Code = Enum.ResultCodeEnum.Success;
            return obj;
        }
        #endregion
    }
}
